import { transformI18n, $t } from "@/plugins/i18n";

function modelStatus(status) {
    const data = {
        0: 'success',
        1: '',
        2: 'warning',
    }
    return data[status]
}

function agvstatusType(status) {
    const data = {
        '障碍物': "warning",
        '阻塞': "info",
        '错误': "danger",
        '运行中': "success",
        '空闲': "",
        '离线': "info"
    }
    return data[status]
}

function AGVModeFilter(status) {
    const data = {
        0: $t('home.manual'),
        1: $t('home.automatic')
    }
    return data[status]
}

function formatConnectionStatus(status) {
    const data = {
        0: "info",
        1: "success",
        2: "",
    }
    return data[status]
}

function taskStatus(status) {
    const data = {
        0: "",
        1: "success",
        2: "info",
        3: "success",
        4: "danger",
    }
    return data[status]
}

// status（车辆状态）: 1: 启用，0: 禁用

// connectionstatus（连接状态）： 0: 未连接，1: 已连接，2: 已注册

// taskstatus（任务状态）：0: 空闲，1: 等待中，2: 运行中，3: 暂停中，4: 已完成，5: 失败，6: 取消


function taskType(status) {
    const data = {
        0: "",
        1: "success",
        2: "warning",
        3: "info",
    }
    return data[status]
}

function ConnectionStatusFilter(status) {
    const data = {
        0: $t('home.notConnected'),
        1: $t('home.connected'),
        2: $t('home.launched'),
    }
    return data[status]
}

function agvStatus(status) {
    const data = {
        0: 'danger',
        1: 'success',
        2: 'warning'
    }
    return data[status]
}

function statusText(status) {
    const data = {
        0: $t('home.disable'),
        1: $t('home.enable'),
        2: $t('home.abnormal')
    }
    return data[status]
}

function jobStatus(status) {
    const data = {
        0: '',
        1: 'success',
        2: 'info',
        3: 'success',
        4: 'danger',
        5: 'warning'
    }
    return data[status]
}

function agvTypeStatus(status) {
    const data = {
        0: '',
        1: 'success',
        2: 'info',
        3: 'success',
        4: 'danger',
        5: 'warning'
    }
    return data[status]
}

function errorStatus(status) {
    const data = {
        '0': "",
        '101': "定位失败",
        '102': "后避障或广电触发",
        '103': "紧停或防撞触边触发",
        '104': "动作任务错误",
        '105': "货叉找零错误",
        '106': "载货失败",
        '107': "io板报错",
        '129': "移动错误",
        '131': "后退请求拒绝",
        '133': "创建任务失败",
        '134': "派发任务失败",
        '135': "请求未响应",
        '136': "雷达坐标更新超时",
        '137': "雷达坐标差异过大",
        '139': "等待交管信号",
        '140': "交管通知停止",
        '142': "脱轨错误"
    }
    return data[status]
}

export {
    modelStatus,
    agvstatusType,
    AGVModeFilter,
    formatConnectionStatus,
    ConnectionStatusFilter,
    agvStatus,
    statusText,
    jobStatus,
    agvTypeStatus,
    errorStatus,
    taskType,
    taskStatus
}